#!/usr/bin/env sh

if [ `uname` != "Darwin" ]; then
    echo "-- please execute this sh on Mac OS!"
    exit 0
fi


cur_dir=$(pwd)
for dir in $(ls -F | grep /)
do
    dir=`basename $dir`
    if [ -d "$cur_dir/$dir/.git" ];then
        project_name=`basename $dir`
        cd $cur_dir/$dir
        formal=`git remote -v | grep origin | grep -vE 'origin_|fetch'| awk '{printf( "%s\n", $2)}'`
        echo $formal | grep "https://github.com" > /dev/null
        if [ $? -eq 0 ]; then
            continue
        fi

        cd $cur_dir
        ./new_git_rep.sh $project_name
    fi
done

exit 0


